﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.JiesuanguanliDemo.XiaoxiangDataManager.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.JiesuanguanliDemo.XiaoxiangDataManager
{
    public class XiaoxiangDataService : AsyncCrudAppService<XiaoxiangData, XiaoxiangDataInputDto, int, PageXiaoxiangDataRequestDto, XiaoxiangDataCreateDto, XiaoxiangDataUpdateDto>, IXiaoxiangDataService
    {
        public XiaoxiangDataService(
      IRepository<XiaoxiangData, int> repository) : base(repository)
        {

        }
        /// <summary>
        /// 自定义分页条件查询, 需要重写父类的CreateFilteredQuery方法,让其进行自定义条件筛选
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        protected override IQueryable<XiaoxiangData> CreateFilteredQuery(PageXiaoxiangDataRequestDto input)
        {
            return base.CreateFilteredQuery(input)

                 .WhereIf(!string.IsNullOrEmpty(input.kehu), c => c.kehu.Contains(input.kehu))
                  .WhereIf(!string.IsNullOrEmpty(input.leixing), c => c.leixing.Contains(input.leixing))

                    .WhereIf(input.riqi.HasValue, c => c.riqi == input.riqi);
        }
    }
}
